<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link
      href="https://cdn.bootcdn.net/ajax/libs/animate.css/4.1.1/animate.min.css"
      rel="stylesheet"
    />
    <style>
      /* .fade-enter-active,
      .fade-leave-active {
        transition: opacity 0.5s ease;
      }

      .fade-enter-from,
      .fade-leave-to {
        opacity: 0;
      } */

      /* .fade-enter-active {
        transition: all 0.3s ease-out;
      }

      .fade-leave-active {
        transition: all 0.8s cubic-bezier(1, 0.5, 0.8, 1);
      } */

      /* .abc, */
      /* .fade-leave-to {
        transform: translateX(20px);
        opacity: 0;
      } */
    </style>
  </head>
  <body>
    <div id="app">
      <h2>过渡动画</h2>
      <button @click="show = !show">btn</button>
      <!-- 需要给切换的元素加上transition标签 -->
      <!-- 当使用了transition后，就可以直接使用6个类名 -->
      <!-- 
        v-enter-from 进来前
        v-enter-active 进来中
        v-enter-to 进来后
        v-leave-from 离开前
        v-leave-active 离开中
        v-leave-to 离开后
       -->
      <!-- transition可以添加name属性 -->
      <transition
        name="fade"
        enter-from-class="animate__animated animate__zoomIn"
        leave-to-class="animate__animated animate__rotateOut"
      >
        <div v-if="show" style="width: 32px; background-color: red">你好</div>
      </transition>
    </div>

    <script src="./Vue3.js"></script>
    <script>
      const { createApp } = Vue;

      createApp({
        data() {
          return {
            show: true,
          };
        },
      }).mount("#app");
    </script>
  </body>
</html>
